﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>

    <link href="/WF/Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/WF/Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="/WF/Style/skin/css/Default.css" rel="stylesheet" />

    <!--<link href="/WF/Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/WF/Scripts/bootstrap/css/font-awesome.css" rel="stylesheet">
    <link href="/WF/Style/skin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/WF/Style/skin/css/animate.css" rel="stylesheet" type="text/css" />
    <link href="/WF/Style/skin/font/iconfont.css" rel="stylesheet" type="text/css" />-->
    <!--通用js-->
    <script src="/WF/Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script src="/WF/Scripts/QueryString.js" type="text/javascript"></script>
    <script src="/WF/Scripts/config.js" type="text/javascript"></script>
    <script src="/WF/Comm/Gener.js" type="text/javascript"></script>

    
    <script type="text/javascript">
        var workID = GetQueryString("WorkID"); //workid 子线程的ID
        var fid = GetQueryString("FID"); //fid.
        $(function () {

            //传入数据调用ajax. 返回查询犯人的接口.
            var data = "";
            var webUser = new WebUser();
            //获得.
            var ens = new Entities("BP.JianYu.Fanrens");
            ens.Retrieve("WorkIDOf001", fid, "FenJianQuNo", webUser.FK_Dept,"DelFlag",0);

            //设置workid.
            for (var i = 0; i < ens.length; i++) {
                var en = ens[i];
                if (en.WorkIDOfSubthread == 0) {
                    en = new Entity("BP.JianYu.Fanren", en.CRID);
                    en.WorkIDOfSubthread = workID;
                    en.Update();
                }
            }
            //ens.Retrieve("WorkIDOfSubthread", workID);
            console.log(ens);

            var html = "审批名单<table class='table table-bordered table - hover' >";
            html += "<tr>";
            html += "<th>编号</th>";
            html += "<th>姓名</th>";
            html += "<th>年龄</th>";
            html += "<th>监区</th>";   //监区
            html += "<th>分监区</th>"; //分监区
            html += "<th>入监日期</th>";
            html += "<th>罪名</th>";
            html += "<th>罪犯类型</th>";
            html += "<th>罪犯类别</th>";
            html += "<th>原判刑期</th>";
            html += "<th>现刑期</th>";
            html += "<th>减刑间隔</th>";
            html += "<th>减刑幅度</th>";
            html += "<th>表扬次数</th>";
            html += "<th>年累计分</th>";
            html += "<th>是否老病残</th>";
            html += "<th>是否立功</th>";
            html += "<th>是否重大立功</th>";
            html += "<th>操作</th>"; //分监区
            html += "</tr>";

            for (var i = 0; i < ens.length; i++) {
                var en = ens[i];
                var lbc = "否";
                if (en.ShiFouLBC == 1)
                    lbc = "是";
                var lg =  "否";
                if (en.ShiFouLG == 1)
                    lg = "是";
                var zdlg = "否";
                if (en.ShiFouZDLG == 1)
                    zdlg = "是";
                
                html += "<tr>";
                html += "<td>" + en.MyPK + "</td>";
                html += "<td>" + en.Name + "</td>";
                html += "<td>" + en.Age + "</td>";
                html += "<td>" + en.JianQuNo + en.JianQuNoText + "</td>"; //监区
                html += "<td>" + en.FenJianQuNo + en.FenJianQuNoText + "</td>"; //分监区

                html += "<td>" + en.DTComein + "</td>";
                html += "<td>" + en.ZuiMing + "</td>";
                html += "<td>" + en.ZuiFanLX + "</td>";
                html += "<td>" + en.ZuiFanLB + "</td>";
                html += "<td>" + en.YuanPanXQ + "</td>";
                html += "<td>" + en.XianXQ + "</td>";
                html += "<td>" + en.JianXingJG + "</td>";
                html += "<td>" + en.JianXingFD + "</td>";
                html += "<td>" + en.BiaoYangCS + "</td>";
                html += "<td>" + en.NianLeiJF + "</td>";
                html += "<td>" + lbc + "</td>";
                html += "<td>" + lg + "</td>";
                html += "<td>" + zdlg+ "</td>";
                html += "<td><a href=\"javascript:Update('" + en.MyPK + "')\" >修改</a>|<a href=\"javascript:Del('" + en.MyPK + "')\" >删除</a></td>"; //操作

                html += "</tr>";
            }
            html += "</table>";

            //获得候补名单
            var enHs = new Entities("BP.JianYu.Fanrens");
            enHs.Retrieve("WorkIDOf001", fid, "FenJianQuNo", webUser.FK_Dept, "DelFlag", 1);

            //设置workid.
            for (var i = 0; i < enHs.length; i++) {
                var en = enHs[i];
                if (en.WorkIDOfSubthread == 0) {
                    en = new Entity("BP.JianYu.Fanren", en.CRID);
                    en.WorkIDOfSubthread = workID;
                    en.Update();
                }
            }
            //ens.Retrieve("WorkIDOfSubthread", workID);
            //console.log(ens);

            html += "候补名单<table class='table table-bordered table - hover' >";
            html += "<tr>";
            html += "<th>编号</th>";
            html += "<th>姓名</th>";
            html += "<th>年龄</th>";
            html += "<th>监区</th>";   //监区
            html += "<th>分监区</th>"; //分监区
            html += "<th>入监日期</th>";
            html += "<th>罪名</th>";
            html += "<th>罪犯类型</th>";
            html += "<th>罪犯类别</th>";
            html += "<th>原判刑期</th>";
            html += "<th>现刑期</th>";
            html += "<th>减刑间隔</th>";
            html += "<th>减刑幅度</th>";
            html += "<th>表扬次数</th>";
            html += "<th>年累计分</th>";
            html += "<th>是否老病残</th>";
            html += "<th>是否立功</th>";
            html += "<th>是否重大立功</th>";
            html += "<th>操作</th>"; //分监区
            html += "</tr>";

            for (var i = 0; i < enHs.length; i++) {
                var en = enHs[i];
                var lbc = "否";
                if (en.ShiFouLBC == 1)
                    lbc = "是";
                var lg = "否";
                if (en.ShiFouLG == 1)
                    lg = "是";
                var zdlg = "否";
                if (en.ShiFouZDLG == 1)
                    zdlg = "是";

                html += "<tr>";
                html += "<td>" + en.MyPK + "</td>";
                html += "<td>" + en.Name + "</td>";
                html += "<td>" + en.Age + "</td>";
                html += "<td>" + en.JianQuNo + en.JianQuNoText + "</td>"; //监区
                html += "<td>" + en.FenJianQuNo + en.FenJianQuNoText + "</td>"; //分监区

                html += "<td>" + en.DTComein + "</td>";
                html += "<td>" + en.ZuiMing + "</td>";
                html += "<td>" + en.ZuiFanLX + "</td>";
                html += "<td>" + en.ZuiFanLB + "</td>";
                html += "<td>" + en.YuanPanXQ + "</td>";
                html += "<td>" + en.XianXQ + "</td>";
                html += "<td>" + en.JianXingJG + "</td>";
                html += "<td>" + en.JianXingFD + "</td>";
                html += "<td>" + en.BiaoYangCS + "</td>";
                html += "<td>" + en.NianLeiJF + "</td>";
                html += "<td>" + lbc + "</td>";
                html += "<td>" + lg + "</td>";
                html += "<td>" + zdlg + "</td>";
                html += "<td><a href=\"javascript:Update('" + en.MyPK + "')\" >修改</a>|<a href=\"javascript:DelRe('" + en.MyPK + "')\" >加入审批名单</a></td>"; //操作

                html += "</tr>";
            }
            html += "</table>";
            $("#docs").html(html);

            //console.log(html);
            var handler = new HttpHandler("BP.JianYu.AppHandler");
            handler.AddPara("Ens", data);

        });

        //逻辑删除，改变状态
        function Del(id) {

            if (window.confirm('您确定要删除吗？') == false)
                return;

            var en = new Entity("BP.JianYu.Fanren", id);
            en.DelFlag = 1;
            en.Update();
            window.location.href = window.location.href;
        }
        //加回到审批列表，改变状态
        function DelRe(id) {

            if (window.confirm('您确定要加入到审批名单吗？') == false)
                return;

            var en = new Entity("BP.JianYu.Fanren", id);
            en.DelFlag = 0;
            en.Update();
            window.location.href = window.location.href;
        }
        //修改
        function Update(id) {
            var url = "/WF/Comm/En.htm?EnName=BP.JianYu.Fanren&PKVal=" + id;
            var newWindow = window.open(url, '', 'width=800,height=750,top=100,left=300,scrollbars=yes,resizable=yes,toolbar=false,location=false,center=yes,center: yes;');
            newWindow.focus();
            return;
        }
        //保存查询结果.
        function AddNew() {

            var webUser = new WebUser();
            var name = window.prompt('请输入编号', "001");
            if (name == null)
                return;

            var en = new Entity("BP.JianYu.Fanren");
            en.FenJianQuNo = webUser.FK_Dept; //当前登录人员所在的部门.
            en.No = workID + "_" + name;
            en.Name = name;
            en.WorkIDOfSubthread = workID;
            en.WorkIDOf001 = fid;
            en.Insert();

            window.location.href = window.location.href;
        }

        //执行发送到下一步.
        function SendIt() {

            if (window.confirm('确定要发送吗？') == false)
                return;

            //  $("#toolbar").hid();
            $("#toolbar").html("正在发送请稍后.");

            var handler = new HttpHandler("BP.JianYu.AppHandler");
            handler.AddUrlData();
            var data = handler.DoMethodReturnString("ND102_SendIt");
            $("#toolbar").html("发送成功...");
            $("#docs").html(data);
        }
        function Chart() {
            var url = "/WF/WorkOpt/OneWork/Chart.htm?WorkID=" + GetQueryString("WorkID") + "&FK_Node=" + GetQueryString("FK_Node");
            url += "&FID=" + GetQueryString("FID") + "&FK_Flow=001";
            WinOpen(url);
        }
        function Search() {
            var url = "SearchFanren.htm?WorkID=" + GetQueryString("WorkID") + "&FK_Node=" + GetQueryString("FK_Node");
            url += "&FID=" + GetQueryString("FID") + "&FK_Flow=001";
            WinOpen(url);
        }
        function ReturnWork() {
            var url = "/WF/WorkOpt/ReturnWork.htm?WorkID=" + GetQueryString("WorkID") + "&FK_Node=" + GetQueryString("FK_Node");
            url += "&FID=" + GetQueryString("FID");
            WinOpen(url);
        }
    </script>
</head>
<body>

    <div id="Toolbar"></div>

    <div id="toolbar" style="padding:5px;">
      
        <!--
    <button onclick="Search()"> 步骤1:查询可以减刑的犯人</button>-->
        <button onclick="SendIt()"> 发送</button>
        <button onclick="Chart()"> 流程图</button>
        <!--<button onclick="ReturnWork()"> 退回</button>-->
        <button onclick="Search()"> 选择罪犯</button>
    </div>

    <div id="docs">
    </div>

</body>
</html>
